import request from '@/utils/request'
import store from '@/store'

export function getHouseByPage(currentPage, pageSize) {
  return request({
    url: '/house/getHouseByPage',
    method: 'get',
    params: {
      currentPage,
      pageSize
    }
  })
}

export function getHouseById(id) {
  return request({
    url: '/house/getHouseById',
    method: 'get',
    params: {
      id
    }
  })
}

export function removePicture(fileName) {
  return request({
    url: '/house/removePicture',
    method: 'get',
    params: {
      fileName
    }
  })
}

export function updateHouseById(data) {
  return request({
    url: '/house/updateHouseById',
    method: 'post',
    data
  })
}

export function createHouseByAdmin(data) {
  return request({
    url: '/house/createHouse?token='+store.getters.token,
    method: 'post',
    data
  })
}

export function getHouseSale(data) {
  return request({
    url: '/house/getHouseSale?token='+data.token+'&id='+data.id,
    method: 'get'
  })
}
